package com.test.auth_db_auto.support;

import com.test.auth_db_auto.support.properities.BootBaseLoginProperties;
import com.test.auth_db_auto.support.properities.BootSmsLoginProperties;
import com.test.auth_db_auto.support.properities.BootTokenStoreProperties;
import com.test.auth_db_auto.support.properities.CodeStoreType;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.context.annotation.Configuration;

/**
 * @ Author: .Mr
 * @ ClassName BootSecurityProperties
 * @ Description TODO
 * @ date 2021/12/25 15:38
 * @ Version 1.0
 * 配置
 */
@Getter
@Setter
@Configuration
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "boot.oauth")
public class BootSecurityProperties {

    //登录页面
    private String loginPage="/auth/login";

    /**
     * 获取验证码
     */
    private String codePath = "/auth/code";

    // 验证码存储位置 {session}，{redis}
    private CodeStoreType codeStoreType = CodeStoreType.session;

    // redis 存储的验证码过期时间 单位 秒
    private long codeExpireTime = 300;



    /**
     * 用户名密码登录相关配置
     */
    @NestedConfigurationProperty
    private BootBaseLoginProperties baseLogin = new BootBaseLoginProperties();

    /**
     * 短信验证码登录相关配置
     */
    @NestedConfigurationProperty
    private BootSmsLoginProperties smsLogin =  new BootSmsLoginProperties();

    /**
     * token储存类型 相关配置
     */
    @NestedConfigurationProperty
    private BootTokenStoreProperties oauth2 = new BootTokenStoreProperties();
}
